/*
Created		2010/11/11
Modified		2011/1/15
Project		
Model			
Company		
Author		
Version		
Database		MS SQL 2000 
*/

use eBilling
go

Create table [COLUMN_DEFINITION]
(
	[COLUMN_DEF_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[FORMAT_DEF_PK] Numeric(19,0) NOT NULL,
	[IS_HEADER] Tinyint NOT NULL,
	[COLUMN_NAME] Varchar(30) NOT NULL,
	[COLUMN_TITLE] Varchar(40) NOT NULL,
	[COLUMN_TYPE] Varchar(1) NOT NULL,
	[BEGIN_INDEX] Integer NULL,
	[END_INDEX] Integer NULL,
	[IS_QUERY] Tinyint NULL,
	[IS_DISPLAY] Tinyint NULL,
	[IS_REQUIRED] Tinyint NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([COLUMN_DEF_PK])
) 
go

Create table [FORMAT_DEFINITION]
(
	[FORMAT_DEF_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[GROUP_PK] Numeric(19,0) NOT NULL,
	[FORMAT_NAME] Varchar(255) NOT NULL,
	[IS_DELETED] Tinyint NOT NULL,
	[CUSTOM_VALIDATE_CLASS] Varchar(100) NULL,
	[JRXML_PATH] Varchar(255) NULL,
	[CUSTOM_PDF_CLASS] Varchar(100) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([FORMAT_DEF_PK])
) 
go

Create table [APP_GROUP]
(
	[GROUP_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[GROUP_NO] Varchar(12) NOT NULL, UNIQUE ([GROUP_NO]),
	[GROUP_NAME] Varchar(100) NOT NULL,
	[GROUP_TYPE] Integer NOT NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([GROUP_PK])
) 
go

Create table [MAIL_QUEUE]
(
	[MAIL_QUEUE_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[MAIL_SUBJECT] Varchar(100) NOT NULL,
	[MAIL_FROM] Varchar(100) NULL,
	[MAIL_TO] Varchar(255) NOT NULL,
	[MAIL_RETURN_RECEIPT_TO] Varchar(100) NULL,
	[MAIL_CONTENT] Varchar(255) NOT NULL,
	[INLINE_RESOURCE] Varchar(255) NULL,
	[IN_QUEUE_DATE] Datetime NOT NULL,
	[OUT_QUEUE_DATE] Datetime NULL,
	[MAIL_STATUS] Integer NOT NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([MAIL_QUEUE_PK])
) 
go

Create table [MENU_ITEM]
(
	[MENU_ITEM_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[PARENT_MENU_ITEM_PK] Numeric(19,0) NULL,
	[MENU_ID] Varchar(50) NOT NULL,
	[ACTION_PAGE] Varchar(250) NULL,
	[IS_ENABLED] Tinyint NULL,
	[IS_SCHOOL] Tinyint NULL,
	[IS_COMMITTEE] Tinyint NULL,
	[ORDER_NO] Numeric(19,0) NULL,
	[ACTION_BAEN] Varchar(150) NULL,
	[ACTION_NAME] Varchar(255) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([MENU_ITEM_PK])
) 
go

Create table [PAYMENT]
(
	[PAYMENT_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[UPLOAD_FILE_PK] Numeric(19,0) NOT NULL,
	[GROUP_PK] Numeric(19,0) NOT NULL,
	[EXTRA_COLUMNS_PK] Numeric(19,0) NULL,
	[VIRTUAL_ACCOUNT] Varchar(20) NOT NULL,
	[PAYMENT_STATUS] Integer NOT NULL,
	[BARCODE_STORES_1] Varchar(9) NULL,
	[BARCODE_STORES_2] Varchar(20) NULL,
	[BARCODE_STORES_3] Varchar(15) NULL,
	[BARCODE_STORES_1_LOAN] Varchar(9) NULL,
	[BARCODE_STORES_2_LOAN] Varchar(20) NULL,
	[BARCODE_STORES_3_LOAN] Varchar(15) NULL,
	[BARCODE_POST] Varchar(20) NULL,
	[TOTAL_AMOUNT] Numeric(19,0) NULL,
	[TOTAL_LOANABLE_AMOUNT] Numeric(19,0) NULL,
	[PAY_DUE] Datetime NOT NULL,
	[PAYMENT_NAME] Varchar(50) NULL,
	[PDF_FILE_NAME] Varchar(100) NULL,
	[PDF_FILE_PATH_ON_SERVER] Varchar(255) NULL,
	[PAYER_ID] Varchar(10) NULL,
	[PAYER_NAME] Varchar(50) NULL,
	[PAYER_BIRTHDAY] Varchar(8) NULL,
	[PAYER_ADDRESS] Varchar(255) NULL,
	[STUDENT_ID] Varchar(20) NULL,
	[ACADEMIC_YEAR] Varchar(10) NULL,
	[SEMESTER] Varchar(10) NULL,
	[DEPARTMENT] Varchar(40) NULL,
	[GRADE] Varchar(10) NULL,
	[CLASS_NO] Varchar(10) NULL,
	[SEAT_NO] Varchar(10) NULL,
	[PAYMENT_CANCELED_PK] Numeric(19,0) NULL,
	[WRITE_OFF_PAYMENT_PK] Numeric(19,0) NULL,
	[REAL_PAY_AMOUNT] Numeric(19,0) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([PAYMENT_PK])
) 
go

Create table [PAYMENT_CANCELED]
(
	[PAYMENT_CANCELED_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[PAYMENT_PK] Numeric(19,0) NOT NULL,
	[CANCEL_DATE] Datetime NOT NULL,
	[CANCEL_USER_PK] Numeric(19,0) NOT NULL,
	[CANCEL_REASON] Varchar(255) NULL,
	[CONFIRM_STATULS] Tinyint NULL,
	[CONFIRM_DATE] Datetime NULL,
	[CONFIRM_USER_PK] Numeric(19,0) NULL,
Primary Key ([PAYMENT_CANCELED_PK])
) 
go

Create table [PAYMENT_ITEM]
(
	[PAYMENT_ITEM_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[PAYMENT_PK] Numeric(19,0) NOT NULL,
	[ITEM_NAME] Varchar(255) NOT NULL,
	[AMOUNT] Numeric(19,0) NOT NULL,
	[ACCOUNTS] Varchar(100) NULL,
	[IS_LOANABLE] Tinyint NULL,
	[ATTRIBUTE1] Varchar(255) NULL,
	[ATTRIBUTE2] Varchar(255) NULL,
	[ATTRIBUTE3] Varchar(255) NULL,
	[ATTRIBUTE4] Varchar(255) NULL,
	[ATTRIBUTE5] Varchar(255) NULL,
	[ATTRIBUTE6] Varchar(255) NULL,
	[ATTRIBUTE7] Varchar(255) NULL,
	[ATTRIBUTE8] Varchar(255) NULL,
	[ATTRIBUTE9] Varchar(255) NULL,
	[ATTRIBUTE10] Varchar(255) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([PAYMENT_ITEM_PK])
) 
go

Create table [APP_ROLE]
(
	[ROLE_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[GROUP_PK] Numeric(19,0) NOT NULL,
	[ROLE_NO] Varchar(20) NOT NULL,
	[ROLE_NAME] Varchar(50) NOT NULL,
	[ROLE_MEMO] Varchar(255) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([ROLE_PK])
) 
go

Create table [ROLE_MENU]
(
	[ROLE_PK] Numeric(19,0) NOT NULL,
	[MENU_ITEM_PK] Numeric(19,0) NOT NULL
) 
go

Create table [UPLOAD_FILE]
(
	[UPLOAD_FILE_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[FORMAT_DEF_PK] Numeric(19,0) NOT NULL,
	[GROUP_PK] Numeric(19,0) NOT NULL,
	[UPLOAD_USER_PK] Numeric(19,0) NOT NULL,
	[UPLOAD_DATE] Datetime NOT NULL,
	[FILE_NAME] Varchar(100) NOT NULL,
	[FILE_PATH_ON_SERVER] Varchar(255) NOT NULL,
	[FILE_STATUS] Integer NOT NULL,
	[TOTAL_ITEMS] Numeric(19,0) NULL,
	[TOTAL_AMOUNT] Numeric(19,0) NULL,
	[CONFIRM_STATUS] Tinyint NULL,
	[CONFIRM_USER_PK] Numeric(19,0) NULL,
	[CONFIRM_DATE] Datetime NULL,
	[PDF_FILE_NAME] Varchar(100) NOT NULL,
	[PDF_FILE_PATH_ON_SERVER] Varchar(255) NOT NULL,
	[CREATED_DATE] Datetime NULL,
	[CREATED_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
Primary Key ([UPLOAD_FILE_PK])
) 
go

Create table [APP_USER]
(
	[USER_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[GROUP_PK] Numeric(19,0) NOT NULL,
	[USER_ID] Varchar(50) NOT NULL,
	[USER_PWD] Varchar(255) NOT NULL,
	[USER_NAME] Varchar(20) NULL,
	[USER_EMAIL] Varchar(100) NULL,
	[IS_ENABLED] Tinyint NULL,
	[IS_LOCKED] Tinyint NULL,
	[PWD_EXPIRED_DATE] Datetime NULL,
	[LAST_LOGIN_DATE] Datetime NULL,
	[PWD_ERROR_TIME] Integer NULL,
	[CAPTCHA_ERROR_TIME] Integer NULL,
	[PWD_HISTORY] Varchar(255) NULL,
	[USER_PHONE] Varchar(20) NULL,
	[USER_MEMO] Varchar(255) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([USER_PK])
) 
go

Create table [USER_ACTION_LOG]
(
	[ACTION_LOG_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[GROUP_PK] Numeric(19,0) NULL,
	[GROUP_NO] Varchar(12) NULL,
	[GROUP_NAME] Varchar(100) NULL,
	[USER_PK] Numeric(11,0) NULL,
	[USER_ID] Varchar(50) NULL,
	[USER_NAME] Varchar(20) NULL,
	[PARENT_ACTION_NAME] Varchar(255) NULL,
	[ACTION_BAEN] Varchar(250) NULL,
	[ACTION_NAME] Char(255) NULL,
	[EVENT_NAME] Varchar(50) NULL,
	[IN_DATETIME] Datetime NULL,
	[OUT_DATETIME] Datetime NULL,
	[REMOTE_ADDR] Varchar(50) NULL,
	[LOG_NOTE] Varchar(100) NULL,
Primary Key ([ACTION_LOG_PK])
) 
go

Create table [USER_ROLE]
(
	[USER_PK] Numeric(19,0) NOT NULL,
	[ROLE_PK] Numeric(19,0) NOT NULL
) 
go

Create table [WRITE_OFF_PAYMENT]
(
	[WRITE_OFF_PAYMENT_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[PAYMENT_PK] Numeric(19,0) NOT NULL,
	[CHANNEL] Varchar(2) NOT NULL,
	[RL_FLAG] Tinyint NULL,
	[AMOUNT] Numeric(19,0) NOT NULL,
	[WRITE_OFF_DATE] Datetime NOT NULL,
	[WRITE_OFF_STATUS] Integer NOT NULL,
	[WRITE_OFF_USER_PK] Numeric(19,0) NULL,
	[CONFIRM_DATE] Datetime NULL,
	[CONFIRM_USER_PK] Numeric(19,0) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
	[FEEDBACK_UID] Numeric(19,0) NULL,
Primary Key ([WRITE_OFF_PAYMENT_PK])
) 
go

Create table [CODE_TABLE]
(
	[CODE_TABLE_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[CODE_KIND] Varchar(25) NOT NULL,
	[CODE_VALUE] Varchar(10) NOT NULL,
	[CODE_NAME] Varchar(100) NOT NULL,
	[SORT_INDEX] Integer NULL,
Primary Key ([CODE_TABLE_PK])
) 
go

Create table [COLUMN_ERROR]
(
	[COLUMN_VALIDATE_ERROR_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[UPLOAD_FILE_PK] Numeric(19,0) NOT NULL,
	[LINE_NUMBER] Numeric(19,0) NULL,
	[COLUMN_NAME] Varchar(40) NULL,
	[ERROR_MESSAGE] Varchar(255) NULL,
	[EXCEPTION_MESSAGE] Varchar(255) NULL,
Primary Key ([COLUMN_VALIDATE_ERROR_PK])
) 
go

Create table [REAL_ACCOUNT]
(
	[REAL_ACCOUNT_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[GROUP_PK] Numeric(19,0) NOT NULL,
	[ACCOUNT_NO] Varchar(20) NOT NULL,
	[VIRTUAL_ACCOUNT_NO] Varchar(10) NOT NULL,
Primary Key ([REAL_ACCOUNT_PK])
) 
go

Create table [EXTRA_COLUMNS]
(
	[EXTRA_COLUMNS_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[ATTRIBUTE1] Varchar(255) NULL,
	[ATTRIBUTE2] Varchar(255) NULL,
	[ATTRIBUTE3] Varchar(255) NULL,
	[ATTRIBUTE4] Varchar(255) NULL,
	[ATTRIBUTE5] Varchar(255) NULL,
	[ATTRIBUTE6] Varchar(255) NULL,
	[ATTRIBUTE7] Varchar(255) NULL,
	[ATTRIBUTE8] Varchar(255) NULL,
	[ATTRIBUTE9] Varchar(255) NULL,
	[ATTRIBUTE10] Varchar(255) NULL,
	[ATTRIBUTE11] Varchar(255) NULL,
	[ATTRIBUTE12] Varchar(255) NULL,
	[ATTRIBUTE13] Varchar(255) NULL,
	[ATTRIBUTE14] Varchar(255) NULL,
	[ATTRIBUTE15] Varchar(255) NULL,
	[ATTRIBUTE16] Varchar(255) NULL,
	[ATTRIBUTE17] Varchar(255) NULL,
	[ATTRIBUTE18] Varchar(255) NULL,
	[ATTRIBUTE19] Varchar(255) NULL,
	[ATTRIBUTE20] Varchar(255) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
Primary Key ([EXTRA_COLUMNS_PK])
) 
go

Create table [COMMISSION_CODE_TABLE]
(
	[COMMISSION_CODE_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[COMMISSION_CODE] Varchar(5) NOT NULL,
	[COMMISSION_CODE_NAME] Varchar(20) NULL,
	[AMOUNT_SCOPE_S] Numeric(19,0) NOT NULL,
	[AMOUNT_SCOPE_E] Numeric(19,0) NOT NULL,
	[COMMISSION_TYPE] Varchar(1) NOT NULL,
	[COMMISSION_AMOUNT] Numeric(19,0) NULL,
	[CREATED_BY] Varchar(50) NULL,
	[CREATED_DATE] Datetime NULL,
	[UPDATE_BY] Varchar(50) NULL,
	[UPDATE_DATE] Datetime NULL,
	[BANK_AMOUNT] Numeric(19,0) NULL,
Primary Key ([COMMISSION_CODE_PK])
) 
go

Create table [USER_LOGIN_CONTROL]
(
	[USER_LOGIN_CON_PK] Numeric(19,0) Identity(1,1) NOT NULL,
	[USER_PK] Numeric(19,0) NOT NULL,
	[SESSION_ID] Varchar(100) NOT NULL,
	[LOGIN_TIME] Datetime NOT NULL,
	[LOGIN_LOCALE] Varchar(50) NULL,
	[IS_ACTIVED] Tinyint NULL,
	[ACTIVITY_TIME] Datetime NOT NULL,
Primary Key ([USER_LOGIN_CON_PK])
) 
go

Create table [FEEDBACK_LOG]
(
	[UID] Numeric(19,0) Identity(1,1) NOT NULL,
	[FBFILENAME] Varchar(40) NULL,
	[FBTIME] Datetime NULL,
	[FBCODE] Char(1) NULL,
	[MRKEY] Varchar(14) NULL,
	[ADAY] Varchar(8) NULL,
	[ATIME] Varchar(8) NULL,
	[TBSDY] Varchar(8) NULL,
	[APTYPE] Varchar(1) NULL,
	[TXNO] Varchar(2) NULL,
	[DSCPT] Varchar(3) NULL,
	[TXAMT] Numeric(11,0) NULL,
	[USERNO] Varchar(16) NULL,
	[ATMID] Varchar(8) NULL,
	[KINBR] Varchar(3) NULL,
	[TRMSEQ] Varchar(2) NULL,
	[TXTNO] Varchar(5) NULL,
	[TFRBK] Varchar(3) NULL,
	[TFRACT] Varchar(16) NULL,
	[STANBK] Varchar(3) NULL,
	[STANSEQ] Varchar(7) NULL,
	[EC] Char(1) NULL,
	[TRMTYP] Char(1) NULL,
	[FEEDBACK_TYPE] Integer NULL,
	[CHANNEL] Varchar(8) NULL,
	[STORE] Varchar(8) NULL,
	[ACCTDATE] Varchar(8) NULL,
	[BARCDOE1] Varchar(9) NULL,
	[BARCDOE2] Varchar(20) NULL,
	[BARCDOE3] Varchar(15) NULL,
	[ERR_MSG] Varchar(100) NULL,
Primary Key ([UID])
) 
go

Create table [FORMAT_DEF_COMMISSION]
(
	[COMMISSION_CODE_PK] Numeric(19,0) NOT NULL,
	[FORMAT_DEF_PK] Numeric(19,0) NOT NULL
) 
go


Alter table [APP_GROUP] add constraint [UQ__SOEZ_GROUP__GROUP_NO] unique ([GROUP_NO])
go


Alter table [APP_ROLE] add constraint [UQ__SOEZ_ROLE__GROUP_ROLE] unique ([GROUP_PK],[ROLE_NO])
go


Alter table [APP_USER] add constraint [UQ__SOEZ_USER__GROUP_USERID] unique ([USER_ID],[GROUP_PK])
go


Create Index [IDX_BANK_FBTIME] ON [FEEDBACK_LOG] ([FBTIME] Desc) 
go


Alter table [COLUMN_DEFINITION] add  foreign key([FORMAT_DEF_PK]) references [FORMAT_DEFINITION] ([FORMAT_DEF_PK])  on update no action on delete no action 
go
Alter table [UPLOAD_FILE] add  foreign key([FORMAT_DEF_PK]) references [FORMAT_DEFINITION] ([FORMAT_DEF_PK])  on update no action on delete no action 
go
Alter table [FORMAT_DEF_COMMISSION] add  foreign key([FORMAT_DEF_PK]) references [FORMAT_DEFINITION] ([FORMAT_DEF_PK])  on update no action on delete no action 
go
Alter table [FORMAT_DEFINITION] add  foreign key([GROUP_PK]) references [APP_GROUP] ([GROUP_PK])  on update no action on delete no action 
go
Alter table [PAYMENT] add  foreign key([GROUP_PK]) references [APP_GROUP] ([GROUP_PK])  on update no action on delete no action 
go
Alter table [APP_ROLE] add  foreign key([GROUP_PK]) references [APP_GROUP] ([GROUP_PK])  on update no action on delete no action 
go
Alter table [UPLOAD_FILE] add  foreign key([GROUP_PK]) references [APP_GROUP] ([GROUP_PK])  on update no action on delete no action 
go
Alter table [APP_USER] add  foreign key([GROUP_PK]) references [APP_GROUP] ([GROUP_PK])  on update no action on delete no action 
go
Alter table [REAL_ACCOUNT] add  foreign key([GROUP_PK]) references [APP_GROUP] ([GROUP_PK])  on update no action on delete no action 
go
Alter table [ROLE_MENU] add  foreign key([MENU_ITEM_PK]) references [MENU_ITEM] ([MENU_ITEM_PK])  on update no action on delete no action 
go
Alter table [PAYMENT_CANCELED] add  foreign key([PAYMENT_PK]) references [PAYMENT] ([PAYMENT_PK])  on update no action on delete no action 
go
Alter table [PAYMENT_ITEM] add  foreign key([PAYMENT_PK]) references [PAYMENT] ([PAYMENT_PK])  on update no action on delete no action 
go
Alter table [WRITE_OFF_PAYMENT] add  foreign key([PAYMENT_PK]) references [PAYMENT] ([PAYMENT_PK])  on update no action on delete no action 
go
Alter table [ROLE_MENU] add  foreign key([ROLE_PK]) references [APP_ROLE] ([ROLE_PK])  on update no action on delete no action 
go
Alter table [USER_ROLE] add  foreign key([ROLE_PK]) references [APP_ROLE] ([ROLE_PK])  on update no action on delete no action 
go
Alter table [PAYMENT] add  foreign key([UPLOAD_FILE_PK]) references [UPLOAD_FILE] ([UPLOAD_FILE_PK])  on update no action on delete no action 
go
Alter table [COLUMN_ERROR] add  foreign key([UPLOAD_FILE_PK]) references [UPLOAD_FILE] ([UPLOAD_FILE_PK])  on update no action on delete no action 
go
Alter table [PAYMENT_CANCELED] add  foreign key([CONFIRM_USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [PAYMENT_CANCELED] add  foreign key([CANCEL_USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [UPLOAD_FILE] add  foreign key([CONFIRM_USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [UPLOAD_FILE] add  foreign key([UPLOAD_USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [USER_ROLE] add  foreign key([USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [WRITE_OFF_PAYMENT] add  foreign key([WRITE_OFF_USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [WRITE_OFF_PAYMENT] add  foreign key([CONFIRM_USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [USER_LOGIN_CONTROL] add  foreign key([USER_PK]) references [APP_USER] ([USER_PK])  on update no action on delete no action 
go
Alter table [PAYMENT] add  foreign key([EXTRA_COLUMNS_PK]) references [EXTRA_COLUMNS] ([EXTRA_COLUMNS_PK])  on update no action on delete no action 
go
Alter table [FORMAT_DEF_COMMISSION] add  foreign key([COMMISSION_CODE_PK]) references [COMMISSION_CODE_TABLE] ([COMMISSION_CODE_PK])  on update no action on delete no action 
go


Set quoted_identifier on
go


Set quoted_identifier off
go


